// 3.实现一个函数ex3， 使用safeProp 和fp.first找到user的名字的首字母
const fp = require('lodash/fp')
const { Maybe, Container } = require('./support')

let safeProp = fp.curry(function (x, o){
    return Maybe.of(o[x])
})

let user = { id: 2, name: 'Albert' }

//获取某对象 name属性的首字母
let ex3 = (obj) => {
    return safeProp('name',obj).map(fp.first);
}

console.log(ex3(user));